﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Peppers.UI;
using System.Security;

namespace System.Peppers.Win32
{
    [SuppressUnmanagedCodeSecurity]
    internal class User32
    {
        protected const string DLL = "user32.dll";

        [DllImport(DLL, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern MessageBoxResult MessageBox(IntPtr hWnd, string text, string caption, MessageBoxOptions options);

        [DllImport(DLL, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int GetSystemMetrics(SystemMetric nIndex);

        [DllImport(DLL, CharSet = CharSet.Auto)]
        public static extern bool SystemParametersInfo(SPI nAction, int nParam, ref RECT rc, int nUpdate);

        [DllImport(DLL, CharSet = CharSet.Auto)]
        public static extern bool GetMonitorInfo(HandleRef hmonitor, [In, Out]MONITORINFOEX info);

        [DllImport(DLL)]
        public static extern DISP_CHANGE ChangeDisplaySettings(ref DEVMODE devMode, CDS flags);

        [DllImport(DLL, SetLastError = true)]
        public static extern int EnumDisplaySettings(string lpszDeviceName, ENUM iModeNum, ref DEVMODE lpDevMode);

        [DllImport(DLL, ExactSpelling = true)]
        public static extern bool EnumDisplayMonitors(HandleRef hdc, RECT rcClip, MonitorEnumProc lpfnEnum, IntPtr dwData);

        [DllImport(DLL, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern IntPtr GetDC(HandleRef hWnd);

        [DllImport(DLL, CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int ReleaseDC(HandleRef hWnd, HandleRef hDC);

        [DllImport(DLL, ExactSpelling = true, SetLastError = true)]
        public static extern bool BroadcastSystemMessage(BSF_FLAGS flags, ref BSM_RECIPIENT recipients, uint hMsg, IntPtr wParam, IntPtr lParam);

        public delegate bool MonitorEnumProc(IntPtr monitor, IntPtr hdc, IntPtr lprcMonitor, IntPtr lParam);

        protected User32() { }
    }
}
